package logic

import (
	"context"
	"fmt"
	"gorm.io/gorm"
	"jd-mall/jd_srv/internal/svc"
	"jd-mall/jd_srv/jd_srv"
	"jd-mall/models/mysql"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopExamineLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShopExamineLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopExamineLogic {
	return &ShopExamineLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ShopExamineLogic) ShopExamine(in *jd_srv.ShopExamineRequest) (*jd_srv.ShopExamineResponse, error) {
	// todo: add your logic here and delete this line
	shop := mysql.Shops{
		Model: gorm.Model{
			ID: uint(in.ShopId),
		},
		ShopStatus: 0,
	}
	err := shop.ShopExamine()
	if err != nil {
		return nil, fmt.Errorf(err.Error())
	}
	return &jd_srv.ShopExamineResponse{}, nil
}
